#ifndef _REACTOR_NOTIFY_H_
#define _REACTOR_NOTIFY_H_

#pragma once

#include "netfwd.h"
#include "mutex.h"

class Trigger
{
public:
    static Trigger & instance();

    void notify();

private:
    Trigger();

    ~Trigger() throw();

    int32_t drain();

    int32_t get_readfd() const;

    Trigger( const Trigger & );
    Trigger & operator= ( const Trigger & );

    friend class NetReactor;

private:
    mutable Thread_Mutex    m_mutex;
    int32_t         m_written;
    int32_t         m_pipes[2];
};

#endif // _REACTOR_NOTIFY_H_

